package com.cloudbroker.bcs.common.validatioin.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import javax.validation.Constraint;
import javax.validation.Payload;

import com.cloudbroker.bcs.common.util.DateTimeUtil;
import com.cloudbroker.bcs.common.validatioin.constants.ValidationConstants;
import com.cloudbroker.bcs.common.validatioin.constants.ValidationErrorCodes;
import com.cloudbroker.bcs.common.validatioin.validator.DateValueValidator;

@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Constraint(validatedBy = DateValueValidator.class)
public @interface DateValue {
    
    Class<?>[] groups() default {};
    
    String message() default ValidationConstants.MSG_DATE;
    
    Class<? extends Payload>[] payload() default {};
    
    String errorCode() default ValidationErrorCodes.PARAM_NOT_DATE;
    
    /**
     * 指明格式
     * @return
     */
    String pattern() default DateTimeUtil.FORMAT_YYYYMMDD;
    
}
